package com.offline.module.user.controller;

import com.offline.module.user.entity.user.UserInfo;
import com.offline.module.user.service.UserInfoService;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author ZhangHaiWen
 * @title: UserController
 * @projectName offline-discount-sys
 * @description: TODO
 * @date 2022/3/2120:25
 */
@RestController
@RequestMapping(value = "/userinfo")
public class UserController {

    @Autowired
    private UserInfoService userInfoService;

    /**
     * 创建用户
     * @return
     */
    @PostMapping(value = "/create")
    public UserInfo create(
            @RequestBody UserInfo goodsInfo
    ){
        return userInfoService.create(goodsInfo);
    }

    /**
     * 查询用户根据用户名
     * @return
     */
    @GetMapping(value = "/find/{id}")
    public UserInfo find(
            @PathVariable(value = "id") int id
            ){
        return userInfoService.selectById(id);
    }

}
